package com.fa4j.code.mate.model;

import com.fa4j.common.base.model.ModifyCmd;
import com.fa4j.common.data.model.QueryType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;


@Data
@Schema(description = "字段")
public class CodeMateFieldModifyCmd extends ModifyCmd<Integer> {

    @Size(max = 64)
    @Pattern(regexp = CodeMateConstants.PATTERN_FIELD_NAME, message = "方法名称格式错误")
    @Schema(description = "字段名称")
    private String name;

    @NotBlank
    @Size(max = 128)
    @Schema(description = "备注")
    private String remark;

    @Schema(description = "字段类型")
    private CodeMateFieldType type;

    @Schema(description = "模型ID")
    private Integer modelId;

    @Schema(description = "是否是数组")
    private Boolean isList;

    @Min(1)
    @Max(99)
    @Schema(description = "优先级")
    private Integer priority;

    @Schema(description = "是否必填")
    private boolean required;

    @Schema(description = "默认值")
    private String defaultValue;

    @Schema(description = "长度")
    private Integer length;

    @Schema(description = "正则验证")
    private String pattern;

    @Schema(description = "查询条件")
    private QueryType queryType;
}
